//
//  HLRunTime.m
//  YueYue
//
//  Created by hulu001 on 2023/5/17.
//

#import "HLRunTime.h"
#import <NIMSDK/NIMSDK.h>

static HLRunTime * __shareInstance = nil;

@implementation HLRunTime

+ (instancetype)allocWithZone:(struct _NSZone *)zone {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        __shareInstance = [super allocWithZone:zone];
    });
    return __shareInstance;
}

+ (instancetype)shareInstance {
    return [[self alloc] init];
}

- (id)copyWithZone:(NSZone *)zone {
    return __shareInstance;
}

- (id)mutableCopyWithZone:(NSZone *)zone {
    return __shareInstance;
}



- (void)loginWithData:(HLLoginModel *)login
{
    if (login == nil){
        return;
    }
    [NIMSDK.sharedSDK.loginManager login:login.userId token:login.yxToken completion:^(NSError * _Nullable error) {
        if (error) {
            [QMUITips showWithText:error.localizedDescription];
        }
    }];
    
    if (login.isInfoDone == NO){
        [HLUIHelper setRootInfo];
    } else {
        [HLUIHelper setRootTabBar];
    }
}

@end
